package init;

public  class  Parent {

    public Parent(){
        System.out.println("加载Parent的构造器");
    }

    public int b = 90;

    {
        System.out.println("加载Parent的非静态代码块");
        System.out.println("Parent的非静态代变量b的值为:"+ b);

    }
    public static int a = Parent1.e;

    static {
        System.out.println("加载Parent的静态代码块");
        System.out.println("Parent的静态代变量a的值为:"+ a);
    }

    public  void print7(){
        System.out.println("父类的print7");
    }
    /**
     * 静态内部类
     */
    static class Parent1{
        public static int e = a;
        public int f = a;

        public static void main(String[] args) {
        }

    }

    /**
     * 成员内部类
     */
    class  parent2{
        public  int g = a;
        public int h = b;
        public   void print(){

        }
    }


    public void print(){
        /**
         * 局部内部类
         */
        class parent3{
            public  int i = a;
            public int j = b;
        }

        /**
         * 匿名内部类
         */
        new Thread(new Runnable() {
            int  p = a;
            int o = b;
            @Override
            public void run() {
                System.out.println();
            }
        }).start();
    }





}

 class Sub extends Parent{

     public Sub(){
         System.out.println("加载Sub的构造器");
     }
     public  int d = 90;

     {
         System.out.println("加载Sub的非静态代码块");
         System.out.println("sub的非静态代变量d的值为:"+d);

     }
     public static int c = 80;
     static {
         System.out.println("加载Sub的静态代码块");
         System.out.println("sub的静态代变量c的值为:"+c);
     }


     public void print7(){

     }

     public static void main(String[] args) {
         Sub sub = new Sub();
         sub.print7();
     }

}

